import { defineStore } from "pinia";
import $td from "@/components/td/index";

const getBodyData = async () => {
  $td.openLoading();

  const response: any = await $td.request.request({
    url: "isetting",
    method: "get",
  });

  return response.data;
};

let bodyData = {};

const useSetting = defineStore("setting", {
  state: () => ({
    bodyData,
  }),
  actions: {
    async initBodyData() {
      let res = await getBodyData();
      this.bodyData = res;
      return this.bodyData;
    },
    getInfo() {
      return this.bodyData;
    },
  },
});

export default useSetting;
